//
// Created by francklinson on 2021/11/28 AT 15:23.
// May Saint Diana bless you!
//

#include <iostream>


using namespace std;

class Solution {
public:
    vector<int> distributeCandies(int candies, int num_people) {
        vector<int> ans(num_people, 0);
        int i = 0;
        while (candies > 0) {
            ans[i % num_people] += min(candies,i+1);
            candies -= ++i;
        }
        return ans;
    }
};

int main() {
    Solution solution;
    vector<int> ans = solution.distributeCandies(10, 3);
    for (const int &x: ans) cout << x << endl;
    return 0;
}

